package com.billing.aop;

import org.apache.log4j.Logger;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;

@Aspect
public class ServiceAOPLogger {

	private Logger logger = Logger.getLogger(ServiceAOPLogger.class);
	
	@Before("execution(* com.billing.service.*Service*.*(..))")
	public void trackServiceExecution(JoinPoint point ){
		logger.debug("TRACE SERVICE EXECUTION Executing: " + point.getSignature().getName());
		System.out.println("Executing: " + point.getSignature().getName());
	}
	
	
	@Before("execution(* getAllBillingEntries(..))")
	public void trackAllExecutions(JoinPoint point ){
		logger.debug("TRACE ALL EXECUTIONS: Executing: " + point.getSignature().getName());
		System.out.println("Executing: " + point.getSignature().getName());
	}
	
}
